package cn.exrick.xboot.common.utils;

import java.util.UUID;

public class RandomUserInfoUtil {

    public static String generateRandomUsername() {
        // 生成6位随机字母数字组合
        String chars = "abcdefghijklmnopqrstuvwxyz0123456789";
        StringBuilder randomStr = new StringBuilder();
        for (int i = 0; i < 6; i++) {
            int index = (int)(Math.random() * chars.length());
            randomStr.append(chars.charAt(index));
        }
        return randomStr.toString();
    }

    public static String generateRandomAvatar() {
        // 可选风格：avataaars, bottts, initials, pixel-art, shapes 等
        String style = "pixel-art";
        // 生成随机种子
        String seed = UUID.randomUUID().toString().substring(0, 8);
        // 构建 DiceBear API URL
        return String.format("https://api.dicebear.com/7.x/%s/svg?seed=%s", style, seed);
    }

}
